{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=2993
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var
	i,n:longint;
	a:array[0..1000010] of int64;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
a[1]:=3;
a[2]:=7;
for i:=3 to n do
	a[i]:=a[i-1]*2+a[i-2];
write(a[n]);
end.  